//
//  L2Singleton.m
//  Lesson2
//
//  Created by Alexander Trifonov on 20.04.12.
//  Copyright (c) 2012 fgengine@gmail.com. All rights reserved.
//

#import "L2Singleton.h"

static L2Singleton *L2SingletonShared = nil;

@implementation L2Singleton

+ (L2Singleton*) shared
{
    @synchronized(self)
    {
        if(L2SingletonShared == nil)
        {
            L2SingletonShared = [NSAllocateObject([self class], 0, NULL) init];
        }
    }
    return L2SingletonShared;
}

+ (id) allocWithZone:(NSZone *)zone
{
    return [[self shared] retain];
}

- (id) copyWithZone:(NSZone*)zone
{
    return self;
}

- (id) retain
{
    return self;
}

- (NSUInteger) retainCount
{
    return NSUIntegerMax;
}

- (id) autorelease
{
    return self;
}

@end
